package com.heima.user.utils;

import com.heima.model.wemedia.entity.WmUser;

public class WmThreadLocalUtil {

    private static final ThreadLocal<WmUser> TL = new ThreadLocal();

    /**
     * 保存用户信息到ThreadLocal
     *
     * @param wmUser
     */
    public static void set(WmUser wmUser) {
        if (wmUser != null) {
            TL.set(wmUser);
        }
    }


    /**
     * 从ThreadLocal获取用户信息
     *
     * @return
     */
    public static WmUser get() {
        return TL.get();
    }

    /**
     * 从ThreadLocal获取用户信息
     *
     * @return
     */
    public static void remove() {
        TL.remove();
    }


}
